package com.cctv.order.message;

import com.cctv.order.dto.OrderDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;
import sun.rmi.runtime.Log;

import java.util.zip.Inflater;

/**
 * @Author: cctv
 * @Date: 2019/6/11 11:29
 */
@Component
@EnableBinding(StreamClient.class)
@Slf4j
public class StreamReceiver {
    @StreamListener(StreamClient.INPUT)
    @SendTo(StreamClient.OUTPUT)
    public OrderDTO processInput(OrderDTO message) {
        log.info("---- INPUT StreamReceiver:{}", message);
        return message;
    }

    /**
     * 接受orderDTO对象消息
     * @param message
     */
    @StreamListener(StreamClient.OUTPUT)
    public void processOutput(OrderDTO message) {
        log.info("----StreamReceiver:{}", message);
    }

}
